package cjyyp.day02;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class 死锁 {

    public static void main(String[] args) {
        Object o1=new Object();
        Object o2=new Object();
        new Thread(()->{
            log.debug("t1线程启动");
            synchronized (o1){
                log.debug("t1线程进到o1");
                synchronized (o2){
                    log.debug("t1线程进到o2");
                }
            }
        }).start();
        new Thread(()->{
            log.debug("t2线程启动");
            synchronized (o2){
                log.debug("t2线程进到o2");
                synchronized (o1){
                    log.debug("t2线程进到o1");
                }
            }
        }).start();

    }
}
